package com.example.rabbitmq.comsumer.delay;/**
 * ClassName: TopicReceiverA <br/> Description: <br/> date: 2022/1/24 11:05<br/>
 *
 * @author chenzhian<br />
 * @version
 */

import static com.example.common.config.RabbitMQConfig.DELAYED_QUEUE;
import static com.example.common.config.RabbitMQConfig.RABBITMQ_DELAYED_QUEUE;

import com.example.rabbitmq.comsumer.delay.config.DelayedQueueConfig;
import java.text.SimpleDateFormat;
import java.util.Date;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @Author: chenzhian
 * @Date: 2022/1/24 11:05
 * @Description:
 */
@Component
@Slf4j
public class DelayQueueReceiver {

  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

  @RabbitListener(queues = DELAYED_QUEUE)
  public void process(String msg) {
   log.info("当前时间{}，收到延迟队列的消息：{}",new Date().toString(),msg);
  }
}